package secondfactory.impl;

import secondfactory.Person;

import java.util.Properties;

public class MarkPersonFactory {
    public Person doMarkPerson() throws Exception{
        //创建配置文件对象
        Properties properties = new Properties();
        //读取配置文件
        properties.load(MarkPersonFactory.class.getClassLoader().getResourceAsStream("person.properties"));
        //根据配置文件的key创建对象
        //获取key
        String key = properties.getProperty("person");
        //根据key获取值
        Class<?> aClass = Class.forName(key);
        return (Person)aClass.newInstance();
    }
}
